package com.bins.kafka.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.bins.kafka.producer.KafkaSender;

@RestController
public class SendMsgController {

	@Autowired
	private KafkaSender producer;
	
	@Value("${kafka.topic.topic-name}")
	private String topic;

	@GetMapping("/sendSimple")
	public void sendSimple() {
		producer.sendMessage(topic, "hello spring boot kafka");
	}
	
	@GetMapping("/sendObject")
	public void sendObject() {
		producer.send();
	}

}
